/*
 * Copyright 2025 Nimtable
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


// This file is auto-generated by @hey-api/openapi-ts

export type CatalogCreate = {
    name: string;
    type: string;
    uri?: string;
    warehouse?: string;
    properties?: {
        [key: string]: string;
    };
};

export type Catalog = {
    name: string;
    type: string;
    uri?: string;
    warehouse?: string;
    properties?: {
        [key: string]: string;
    };
};

export type _Error = {
    code: string;
    message: string;
    details?: string;
};

export type SuccessResponse = {
    success: boolean;
    message: string;
};

export type ScheduledTaskCreate = {
    /**
     * Name of the scheduled task
     */
    taskName?: string;
    /**
     * Cron expression for scheduling
     */
    cronExpression: string;
    /**
     * Whether the task is enabled
     */
    enabled?: boolean;
    /**
     * Enable snapshot retention cleanup
     */
    snapshotRetention?: boolean;
    /**
     * Retention period in milliseconds
     */
    retentionPeriod?: number;
    /**
     * Minimum number of snapshots to keep
     */
    minSnapshotsToKeep?: number;
    /**
     * Enable orphan file deletion
     */
    orphanFileDeletion?: boolean;
    /**
     * Orphan file retention period in milliseconds
     */
    orphanFileRetention?: number;
    /**
     * Enable table compaction
     */
    compaction?: boolean;
    /**
     * Target file size for compaction in bytes
     */
    targetFileSizeBytes?: number;
    /**
     * Compaction strategy (e.g., binpack, sort)
     */
    strategy?: string;
    /**
     * Sort order for compaction
     */
    sortOrder?: string;
    /**
     * WHERE clause to filter data during compaction
     */
    whereClause?: string;
    /**
     * User who created the task
     */
    createdBy?: string;
};

export type ScheduledTaskResponse = {
    success: boolean;
    message: string;
    taskId?: number;
    taskName?: string;
    cronExpression?: string;
    cronDescription?: string;
    enabled?: boolean;
    /**
     * Whether this was a create operation
     */
    created?: boolean;
    /**
     * Whether this was an update operation
     */
    updated?: boolean;
};

export type ScheduledTask = {
    /**
     * Unique task ID
     */
    id: number;
    /**
     * Name of the scheduled task
     */
    taskName: string;
    /**
     * Catalog name
     */
    catalogName: string;
    /**
     * Namespace name
     */
    namespace: string;
    /**
     * Table name
     */
    tableName: string;
    /**
     * Cron expression for scheduling
     */
    cronExpression: string;
    /**
     * Human-readable cron description
     */
    cronDescription?: string;
    /**
     * Type of task
     */
    taskType: string;
    /**
     * Whether the task is enabled
     */
    enabled: boolean;
    /**
     * Timestamp of last execution
     */
    lastRunAt?: string;
    /**
     * Status of last execution
     */
    lastRunStatus?: string;
    /**
     * Message from last execution
     */
    lastRunMessage?: string;
    /**
     * Timestamp of next scheduled execution
     */
    nextRunAt?: string;
    /**
     * User who created the task
     */
    createdBy?: string;
    /**
     * Task creation timestamp
     */
    createdAt: string;
    /**
     * Task last update timestamp
     */
    updatedAt: string;
    parameters: TaskParameters;
};

export type TaskParameters = {
    /**
     * Enable snapshot retention cleanup
     */
    snapshotRetention: boolean;
    /**
     * Retention period in milliseconds
     */
    retentionPeriod: number;
    /**
     * Minimum number of snapshots to keep
     */
    minSnapshotsToKeep: number;
    /**
     * Enable orphan file deletion
     */
    orphanFileDeletion: boolean;
    /**
     * Orphan file retention period in milliseconds
     */
    orphanFileRetention: number;
    /**
     * Enable table compaction
     */
    compaction: boolean;
    /**
     * Target file size for compaction in bytes
     */
    targetFileSizeBytes: number;
    /**
     * Compaction strategy
     */
    strategy?: string;
    /**
     * Sort order for compaction
     */
    sortOrder?: string;
    /**
     * WHERE clause to filter data during compaction
     */
    whereClause?: string;
};

export type ToggleTaskRequest = {
    /**
     * Whether to enable or disable the task
     */
    enabled: boolean;
};

export type ToggleTaskResponse = {
    success: boolean;
    message: string;
    /**
     * Current enabled status of the task
     */
    enabled: boolean;
};

export type SystemInfo = {
    /**
     * Number of available CPU cores
     */
    cpuCount: number;
    /**
     * Maximum available memory in bytes
     */
    maxMemory: number;
};

export type TableInfo = {
    /**
     * The location of the metadata file
     */
    'metadata-location'?: string;
    metadata: {
        'format-version'?: number;
        'table-uuid'?: string;
        location?: string;
        'last-sequence-number'?: number;
        'last-updated-ms'?: number;
        'last-column-id'?: number;
        'current-schema-id'?: number;
        schemas?: Array<{
            type?: string;
            'schema-id'?: number;
            fields?: Array<{
                id?: number;
                name?: string;
                required?: boolean;
                type?: string;
            }>;
        }>;
        'default-spec-id'?: number;
        'partition-specs'?: Array<{
            'spec-id'?: number;
            fields?: Array<{
                [key: string]: unknown;
            }>;
        }>;
        'last-partition-id'?: number;
        'default-sort-order-id'?: number;
        'sort-orders'?: Array<{
            'order-id'?: number;
            fields?: Array<{
                [key: string]: unknown;
            }>;
        }>;
        properties?: {
            [key: string]: string;
        };
        'current-snapshot-id'?: number;
        refs?: {
            main?: {
                'snapshot-id'?: number;
                type?: string;
            };
        };
        snapshots?: Array<{
            'sequence-number'?: number;
            'snapshot-id'?: number;
            'parent-snapshot-id'?: number;
            'timestamp-ms'?: number;
            summary?: {
                operation?: string;
                'added-data-files'?: string;
                'deleted-data-files'?: string;
                'added-records'?: string;
                'deleted-records'?: string;
                'added-files-size'?: string;
                'removed-files-size'?: string;
                'changed-partition-count'?: string;
                'iceberg-version'?: string;
            };
            'manifest-list'?: string;
            'schema-id'?: number;
        }>;
        statistics?: Array<unknown>;
        'partition-statistics'?: Array<unknown>;
        'snapshot-log'?: Array<{
            'timestamp-ms'?: number;
            'snapshot-id'?: number;
        }>;
        'metadata-log'?: Array<{
            'timestamp-ms'?: number;
            'metadata-file'?: string;
        }>;
    };
};

export type GetCatalogsData = {
    body?: never;
    path?: never;
    query?: never;
    url: '/api/catalogs';
};

export type GetCatalogsErrors = {
    /**
     * Unauthorized
     */
    401: _Error;
};

export type GetCatalogsError = GetCatalogsErrors[keyof GetCatalogsErrors];

export type GetCatalogsResponses = {
    /**
     * Successfully retrieved catalog list
     */
    200: Array<string>;
};

export type GetCatalogsResponse = GetCatalogsResponses[keyof GetCatalogsResponses];

export type CreateCatalogData = {
    body: CatalogCreate;
    path?: never;
    query?: never;
    url: '/api/catalogs';
};

export type CreateCatalogErrors = {
    /**
     * Invalid request parameters
     */
    400: _Error;
    /**
     * Internal server error
     */
    500: _Error;
};

export type CreateCatalogError = CreateCatalogErrors[keyof CreateCatalogErrors];

export type CreateCatalogResponses = {
    /**
     * Catalog created successfully
     */
    201: Catalog;
};

export type CreateCatalogResponse = CreateCatalogResponses[keyof CreateCatalogResponses];

export type DeleteCatalogData = {
    body?: never;
    path: {
        catalogName: string;
    };
    query?: never;
    url: '/api/catalogs/{catalogName}';
};

export type DeleteCatalogErrors = {
    /**
     * Invalid request parameters
     */
    400: _Error;
    /**
     * Catalog not found
     */
    404: _Error;
    /**
     * Internal server error
     */
    500: _Error;
};

export type DeleteCatalogError = DeleteCatalogErrors[keyof DeleteCatalogErrors];

export type DeleteCatalogResponses = {
    /**
     * Catalog deleted successfully
     */
    204: void;
};

export type DeleteCatalogResponse = DeleteCatalogResponses[keyof DeleteCatalogResponses];

export type GetTableInfoData = {
    body?: never;
    path: {
        catalog: string;
        namespace: string;
        table: string;
    };
    query?: never;
    url: '/api/catalog/{catalog}/v1/namespaces/{namespace}/tables/{table}';
};

export type GetTableInfoErrors = {
    /**
     * Unauthorized
     */
    401: _Error;
    /**
     * Table not found
     */
    404: _Error;
    /**
     * Internal server error
     */
    500: _Error;
};

export type GetTableInfoError = GetTableInfoErrors[keyof GetTableInfoErrors];

export type GetTableInfoResponses = {
    /**
     * Successfully retrieved table information
     */
    200: TableInfo;
};

export type GetTableInfoResponse = GetTableInfoResponses[keyof GetTableInfoResponses];

export type CreateScheduledTaskData = {
    body: ScheduledTaskCreate;
    path: {
        /**
         * The catalog name
         */
        catalog: string;
        /**
         * The namespace name
         */
        namespace: string;
        /**
         * The table name
         */
        table: string;
    };
    query?: never;
    url: '/api/optimize/{catalog}/{namespace}/{table}/schedule';
};

export type CreateScheduledTaskErrors = {
    /**
     * Invalid request parameters
     */
    400: _Error;
    /**
     * Internal server error
     */
    500: _Error;
};

export type CreateScheduledTaskError = CreateScheduledTaskErrors[keyof CreateScheduledTaskErrors];

export type CreateScheduledTaskResponses = {
    /**
     * Scheduled task created/updated successfully
     */
    200: ScheduledTaskResponse;
};

export type CreateScheduledTaskResponse = CreateScheduledTaskResponses[keyof CreateScheduledTaskResponses];

export type GetScheduledTasksData = {
    body?: never;
    path?: never;
    query?: never;
    url: '/api/optimize/scheduled-tasks';
};

export type GetScheduledTasksErrors = {
    /**
     * Internal server error
     */
    500: _Error;
};

export type GetScheduledTasksError = GetScheduledTasksErrors[keyof GetScheduledTasksErrors];

export type GetScheduledTasksResponses = {
    /**
     * Successfully retrieved scheduled tasks
     */
    200: Array<ScheduledTask>;
};

export type GetScheduledTasksResponse = GetScheduledTasksResponses[keyof GetScheduledTasksResponses];

export type DeleteScheduledTaskData = {
    body?: never;
    path: {
        /**
         * The scheduled task ID
         */
        id: number;
    };
    query?: never;
    url: '/api/optimize/scheduled-task/{id}';
};

export type DeleteScheduledTaskErrors = {
    /**
     * Invalid task ID
     */
    400: _Error;
    /**
     * Scheduled task not found
     */
    404: _Error;
    /**
     * Internal server error
     */
    500: _Error;
};

export type DeleteScheduledTaskError = DeleteScheduledTaskErrors[keyof DeleteScheduledTaskErrors];

export type DeleteScheduledTaskResponses = {
    /**
     * Scheduled task deleted successfully
     */
    200: SuccessResponse;
};

export type DeleteScheduledTaskResponse = DeleteScheduledTaskResponses[keyof DeleteScheduledTaskResponses];

export type GetScheduledTaskData = {
    body?: never;
    path: {
        /**
         * The scheduled task ID
         */
        id: number;
    };
    query?: never;
    url: '/api/optimize/scheduled-task/{id}';
};

export type GetScheduledTaskErrors = {
    /**
     * Invalid task ID
     */
    400: _Error;
    /**
     * Scheduled task not found
     */
    404: _Error;
    /**
     * Internal server error
     */
    500: _Error;
};

export type GetScheduledTaskError = GetScheduledTaskErrors[keyof GetScheduledTaskErrors];

export type GetScheduledTaskResponses = {
    /**
     * Successfully retrieved scheduled task
     */
    200: ScheduledTask;
};

export type GetScheduledTaskResponse = GetScheduledTaskResponses[keyof GetScheduledTaskResponses];

export type ToggleScheduledTaskData = {
    body: ToggleTaskRequest;
    path: {
        /**
         * The scheduled task ID
         */
        id: number;
    };
    query?: never;
    url: '/api/optimize/scheduled-task/{id}/toggle';
};

export type ToggleScheduledTaskErrors = {
    /**
     * Invalid task ID
     */
    400: _Error;
    /**
     * Scheduled task not found
     */
    404: _Error;
    /**
     * Internal server error
     */
    500: _Error;
};

export type ToggleScheduledTaskError = ToggleScheduledTaskErrors[keyof ToggleScheduledTaskErrors];

export type ToggleScheduledTaskResponses = {
    /**
     * Scheduled task toggled successfully
     */
    200: ToggleTaskResponse;
};

export type ToggleScheduledTaskResponse = ToggleScheduledTaskResponses[keyof ToggleScheduledTaskResponses];

export type GetSystemInfoData = {
    body?: never;
    path?: never;
    query?: never;
    url: '/api/optimize/system-info';
};

export type GetSystemInfoErrors = {
    /**
     * Internal server error
     */
    500: _Error;
};

export type GetSystemInfoError = GetSystemInfoErrors[keyof GetSystemInfoErrors];

export type GetSystemInfoResponses = {
    /**
     * Successfully retrieved system information
     */
    200: SystemInfo;
};

export type GetSystemInfoResponse = GetSystemInfoResponses[keyof GetSystemInfoResponses];

export type ClientOptions = {
    baseUrl: `${string}://src` | (string & {});
};